﻿<Page x:Class="PasswordProvider.View.CreditCardDetailsPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:lib="clr-namespace:PasswordProvider.View.Library"
    Title="{Binding DisplayName}"
    ToolTip="{Binding ToolTip}"
	>
	
	<DockPanel Height="Auto" Width="Auto">
		<WrapPanel HorizontalAlignment="Right" DockPanel.Dock="Bottom">
            <Button Width="60" Margin="5" 
                    IsDefault="{Binding CancelCommand.IsDefault}" 
                    Content="{Binding CancelCommand.DisplayName}"
				            Command="{Binding CancelCommand.Command}" 
                    />
            <Button Width="60" Margin="5"                    
                    IsDefault="{Binding CommitChangesCommand.IsDefault}"                    
                    Content="{Binding CommitChangesCommand.DisplayName}"
                    Command="{Binding CommitChangesCommand.Command}" 
                    /> 
		</WrapPanel>
        <TabControl Margin="5">
            <TabItem Header="{Binding IdentityGroupDisplayName}">
                <Grid Margin="5,10">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <TextBlock Margin="5,5,3,0" HorizontalAlignment="Left" Text="{Binding Name.DisplayName}"/>
                    <TextBox Margin="0,5,0,0" Grid.Column="1" HorizontalAlignment="Stretch"
                             Text="{Binding Name.Text, UpdateSourceTrigger=PropertyChanged}" />
                   
                    <TextBlock Margin="5,5,3,0" Grid.Row="1" 
                               Text="{Binding IssuingCompany.DisplayName}"/>
                    <TextBox Margin="0,5,0,0" Grid.Row="1" Grid.Column="1"
                             Text="{Binding IssuingCompany.Text, UpdateSourceTrigger=PropertyChanged}" />
                    
                    <TextBlock Margin="5,5,3,0" Grid.Row="2" 
                               Text="{Binding CompanyPhone.DisplayName}"/>
                    <TextBox Margin="0,5,0,0" Grid.Row="2" Grid.Column="1"
                             Text="{Binding CompanyPhone.Text, UpdateSourceTrigger=PropertyChanged}" />
                    
                    <TextBlock Margin="5,5,3,0" Grid.Row="3" Text="{Binding Website.DisplayName}" />
                    <lib:MultiComboBox Margin="0,5,0,0" Grid.Row="3" Grid.Column="1" 
                              SelectionMode="Single"
                              ItemsSource="{Binding Path=Website.List}"
                              SelectedItem="{Binding Path=Website.SelectedItem}"
                              HorizontalContentAlignment="Left"/>
                    
                    <TextBlock Margin="5,5,3,0" Grid.Row="4" Text="{Binding Tags.DisplayName}" />
                    <lib:MultiComboBox Margin="0,5,0,0" Grid.Row="4" Grid.Column="1" 
                                     SelectionMode="Multiple"
                                     ItemsSource="{Binding Path=Tags.List}"
                                     SelectedItems="{Binding Path=Tags.SelectedItems}"
                                     IsCreateNewEnabled="True"
                                     HorizontalContentAlignment="Left"
                                     DisplaySeparator=", "   />
                    
                     
                    <TextBlock Margin="5,5,3,0" Grid.Row="5" 
                               Text="{Binding Description.DisplayName}"/>
                    <TextBox Margin="0,5,0,0" Grid.Row="6" Grid.ColumnSpan="2" MinHeight="75" TextWrapping="Wrap" 
                             Text="{Binding Description.Text, UpdateSourceTrigger=PropertyChanged}" />
                    
                    
                
                 </Grid>
            </TabItem>
            <TabItem Header="{Binding DataGroupDisplayName}">                   
                <Grid Margin="5,10">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    
                    <TextBlock Margin="5,5,3,0" Grid.Row="0" 
                               Text="{Binding NameOnCard.DisplayName}"/>
                    <TextBox Margin="0,5,0,0" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch"
                             Text="{Binding NameOnCard.Text, UpdateSourceTrigger=PropertyChanged}" />
                    
                    <TextBlock Margin="5,15,3,0" Grid.Row="1" Grid.Column="0" Text="{Binding CardNumber.DisplayName}" />
                    <lib:EncryptedValueEditBox Margin="0,15,0,0" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Stretch"
                                               IsEnabled="{Binding CardNumber.IsEnabled}"
                                               IsReadOnly="{Binding CardNumber.IsReadOnly}"
                                               ToolTip="{Binding CardNumber.ToolTip}"
                                               DisplayString="{Binding CardNumber.DisplayString, Mode=TwoWay}"/>
                    
                    <TextBlock Margin="5,5,3,0" Grid.Row="2" Text="{Binding Code.DisplayName}" />
                    <lib:EncryptedValueEditBox Margin="0,5,0,0" Grid.Row="2" Grid.Column="2" MinWidth="20" HorizontalAlignment="Stretch"
                                               IsEnabled="{Binding Code.IsEnabled}"
                                               IsReadOnly="{Binding Code.IsReadOnly}"
                                               ToolTip="{Binding Code.ToolTip}"
                                               DisplayString="{Binding Code.DisplayString, Mode=TwoWay}" />

                    <TextBlock Margin="5,5,3,0" Grid.Row="3" 
                               Text="{Binding Pin.DisplayName}" />
                    <lib:EncryptedValueEditBox Margin="0,5,0,0" Grid.Row="3" Grid.Column="1" MinWidth="25"  HorizontalAlignment="Stretch"
                                               IsEnabled="{Binding Pin.IsEnabled}"
                                               IsReadOnly="{Binding Pin.IsReadOnly}"
                                               ToolTip="{Binding Pin.ToolTip}"
                                               DisplayString="{Binding Pin.DisplayString, Mode=TwoWay}" />
                    
                    <CheckBox Margin="0,5,0,0" Grid.Row="4" Grid.Column="1" 
                              Content="{Binding ShowHiddenValues.DisplayName}"
                              IsEnabled="{Binding ShowHiddenValues.IsEnabled}"
                              IsChecked="{Binding ShowHiddenValues.IsChecked}"/>
                    
                    <TextBlock Margin="5,15,3,0" Grid.Row="5"
                               Text="{Binding ExpirationDateDisplayName}" />
                    
                    <TextBlock Grid.Row="6" Margin="0,5" VerticalAlignment="Center" HorizontalAlignment="Right" Text="{Binding ExpirationMonth.DisplayName}" />
                        
                    <WrapPanel Margin="0,5" Grid.Row="6" Grid.Column="1" VerticalAlignment="Center">
                        <lib:MultiComboBox Margin="2,0,0,0" MinWidth="45" 
                                           SelectionMode="Single" VerticalAlignment="Center"
                                           IsEnabled="{Binding ExpirationMonth.IsEnabled}"
                                           ItemsSource="{Binding ExpirationMonth.List}"
						                   SelectedItem="{Binding ExpirationMonth.SelectedItem}" />
                          
                        <TextBlock Margin="5,0,0,0" VerticalAlignment="Center"
                                   Text="{Binding ExpirationYear.DisplayName}"/>
                        <lib:MultiComboBox Margin="2,0,0,0" MinWidth="55" VerticalAlignment="Center"
                                           SelectionMode="Single"
                                           IsEnabled="{Binding ExpirationYear.IsEnabled}"
                                           ItemsSource="{Binding ExpirationYear.List}"
                                           SelectedItem="{Binding ExpirationYear.SelectedItem}" />
                    </WrapPanel>

                </Grid>

            </TabItem>
        </TabControl>
    </DockPanel>
</Page>
